Skip to content

Sign in with Microsoft #698

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 41 commits into
base: master
Choose a base branch
from
Open

Sign in with Microsoft #698

wants to merge 41 commits into from

Conversation

barna-isaac
Copy link
Contributor

This is still a work in progress. I've opened a PR because I wanted to see if the tests pass.


Pull Request Check List

  • Unit Tests & Regression Tests Added (Optional)
  • Removed Unnecessary Logs/System.Outs/Comments/TODOs
  • Added enough Logging to monitor expected behaviour change
  • Security - Injection - everything run by an interpreter (SQL, OS...) is either validated or escaped
  • Security - Data Exposure - PII is not stored or sent unencrypted
  • Security - Data Exposure - Test any altered or created endpoints using swagger
  • Security - Access Control - Check authorisation on every new endpoint
  • Security - New dependency - configured sensibly not relying on defaults
  • Security - New dependency - Searched for any know vulnerabilities
  • Security - New dependency - Signed up team to mailing list
  • Security - New dependency - Added to dependency list
  • DB schema changes - postgres-rutherford-create-script updated
  • DB schema changes - upgrade script created matching create script
  • Updated Release Procedure & Documentation (& Considered Implications to Previous Versions)
  • Peer-Reviewed

token will only contain this field if it's requested in scopes
this just checks that the token was signed using one of the keys listed
by the key server. still need to validate the token contents.
Copy link

codecov bot commented May 30, 2025

Codecov Report

Attention: Patch coverage is 84.92063% with 19 lines in your changes missing coverage. Please review.

Project coverage is 36.30%. Comparing base (57e4f2c) to head (6a5fac7).
Report is 18 commits behind head on master.

Files with missing lines Patch % Lines
.../cam/cl/dtg/segue/auth/MicrosoftAuthenticator.java 89.07% 11 Missing and 2 partials ⚠️
...e/configuration/SegueGuiceConfigurationModule.java 0.00% 6 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #698      +/-   ##
==========================================
+ Coverage   35.87%   36.30%   +0.42%     
==========================================
  Files         528      536       +8     
  Lines       23487    23723     +236     
  Branches     2850     2869      +19     
==========================================
+ Hits         8427     8613     +186     
- Misses      14198    14246      +48     
- Partials      862      864       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

}

public static class TestEmailClaim extends TestInvalidPayloadField {
String claim() {

Check notice

Code scanning / CodeQL

Missing Override annotation Note test

This method overrides
TestNonEmptyClaim.claim
; it is advisable to add an Override annotation.
Playing around with the server a little bit, I see lots of instances of
MicrosoftAuthenticator being created (and, interestingly, each log-in
request creates a new instance), but the instance being used is always
the same: the one that's been passed in to userAuthenticationManager,
which is a singleton. It's possible that my local app is uses less
threads than the live app, but even on the live app. However, because
the exchange and token access happen while serving the same request,
I think it's guaranteed that we only ever access the cache from within
the same thread.
when an authentication code cannot be extracted from the callback,
return an error rather than just throwing 500
use our own exceptions, with our own messages. this way, we avoid
leaking potentially sensitive information to an attacker.
MSAL4J automatically requested this. A string-replace worked for
removing the scope from the authorization URL, but the `/token` endpoint
also needs scopes, and I didn't find an easy way to modify the behavior
of `.acquireToken`. I ended up just using the same lib used
 for Raspberry PI and Google authentication.
}

public static class TestOidClaim extends TestUUIDClaim {
String claim() {

Check notice

Code scanning / CodeQL

Missing Override annotation Note test

This method overrides
TestNonEmptyClaim.claim
; it is advisable to add an Override annotation.
}

public static class TestTidClaim extends TestUUIDClaim {
String claim() {

Check notice

Code scanning / CodeQL

Missing Override annotation Note test

This method overrides
TestNonEmptyClaim.claim
; it is advisable to add an Override annotation.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant